webpackJsonp([13],[
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

	"use strict";

	var _vue = __webpack_require__(1);

	var _vue2 = _interopRequireDefault(_vue);

	var _utils = __webpack_require__(40);

	var _utils2 = _interopRequireDefault(_utils);

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

	function qqlogin(openId, accessToken) {
	    _utils2.default.post('/login/qq.json', { openId: openId, accessToken: accessToken }, function (rs) {
	        _utils2.default.token(rs.data.token);
	        _utils2.default.user(rs.data.user);
	        location.href = _utils2.default.config.ctx + '/adminManager';
	    });
	}
	new _vue2.default({
	    el: '#login',
	    data: { password: null, email: null, params: {}, remember: false },
	    created: function created() {
	        if (location.search) {
	            this.params = _utils2.default.getQueryParams(location.search);
	            switch (this.params['status']) {
	                case "expired":
	                    toastr.warning('会话已过期');
	                    break;
	                case "success":
	                    toastr.success('操作成功');
	                    break;
	            }
	        }
	        var self = this;
	        setTimeout(function () {
	            $('#email').focus();
	            if (localStorage.getItem('login.remember') == 1) {
	                self.email = localStorage.getItem('user.email') || '';
	                self.password = localStorage.getItem('user.password') || '';
	                self.remember = true;
	            }
	        }, 100);
	    },
	    methods: {
	        submit: function submit() {
	            this.$validate(true);
	            if (!this.$form.valid) {
	                return false;
	            }
	            var self = this;
	            _utils2.default.post('/login.json', {
	                email: this.email, password: this.password
	            }, function (rs) {
	                if (self.remember) {
	                    localStorage.setItem('user.email', self.email);
	                    localStorage.setItem('user.password', self.password);
	                    localStorage.setItem('login.remember', '1');
	                } else {
	                    localStorage.setItem('user.email', '');
	                    localStorage.setItem('user.password', '');
	                    localStorage.setItem('login.remember', '0');
	                }
	                _utils2.default.login.success(rs.data.token, rs.data.user, self.params['refer']);
	            });
	            _czc.push(['_trackEvent', '登录', '账户密码']);
	        },
	        qq: function qq() {
	            _utils2.default.login.qq();
	            _czc.push(['_trackEvent', '登录', 'QQ']);
	        },
	        weibo: function weibo() {
	            _utils2.default.login.weibo();
	            _czc.push(['_trackEvent', '登录', '微博']);
	        },
	        github: function github() {
	            _utils2.default.login.github();
	            _czc.push(['_trackEvent', '登录', 'GITHUB']);
	        }
	    }
	});

/***/ })
]);